'''
Created on Mar 14, 2012

@author: wilshusensk
'''

    
'''
dirname = os.environ['HOME'] + "/Desktop" + "/ConstellationList/"
    lists = [i for i in os.listdir(dirname)]
    firstfile = dirname + lists[0]
    print(firstfile)
    f = open(firstfile)
'''


'''
    for curCharacter in range(index+8, lengthOfString):
        curCharacter = linelist[curCharacter]
        ascii = ord(curCharacter)
        if curCharacter == ">":
            break
        elif  ascii == 32 or ascii == 61 or ascii == 34:
            pass
        else:
            fstring += curCharacter
    #print fstring
'''


"""
def getAllInfoForSites():
    #Got to find a way to get the file info and then iterate through the file info to get
    #the information into a database
    
    dirname = os.environ['HOME'] + "/Desktop" + "/HTML/"
    

    sites = [i for i in os.listdir(dirname)]

    for site in sites:
        sitewords = []
        thisfile = dirname + site
        print("getting words from", thisfile)
        f = open(thisfile)
        line = f.readline()
        while line:
            words = cleaner(line, True)
            line = f.readline()
            if not words: pass
            else:
                sitewords.extend(words)

        #name = f.name
        #print(name)
        #lines = f.read()

        #allInfo.append(lines)
        WordCollection.add(site, sitewords)
        
    #wordeach.printValues()
    return WordCollection        
"""











    #searchDatabaseForConstellationsBetweenDeclinations(-10, 80)
    
    #setupTheZipData()

'''
def findDeclinaiton(words):
    NextIsDeclination = False
    Declination = ""
    for i in words:
        if NextIsDeclination == True:
            Declination += i
            break
        if i.lower() == "declination":
            NextIsDeclination = True
    return int(Declination)

        
def findRightAscension(words):
    NextIsAscension = False
    Ascension = ""
    for i in words:
        if NextIsAscension == True:
            Ascension += i
            break
        if i.lower() == "ascension":
            NextIsAscension = True
    return Ascension
'''

'''
def cleaner(line, splitOnSpaces, splitOnOneChar, charToSplit):
    fstring=''
    linelist = list(line)
    for l in range(0, len(linelist)):
        num = ord(linelist[l])
        if splitOnOneChar:
            if num == charToSplit:
                linelist[l] = ":"
        else:
            if  num == 32:
                if(splitOnSpaces):
                    linelist[l]=':'
                else:
                    pass
            elif 57 >= num >= 48 or num == 45:
                pass
            elif linelist[l]<'A' or linelist[l]>'z' or 'Z'<linelist[l]<'a':
                linelist[l]=':'
            elif 'A' <= linelist[l] <= 'Z':
                linelist[l] = chr(ord( linelist[l] ) + 32)
    for l in linelist:
        fstring += l
    words = fstring.split(':')
    words = [word for word in words if len(word) >= 1 and word != 'div' and word!= 'class'
            and word!= 'span' and word!= 'script' and word!= 'li' and word!= 'url' and word!= 'http'
            and word!= 'option' and word!= 'value' and word!= 'id' and word!= 'param' and word!= 'var'
            and word!= 'ul' and word!= 'type' and word!= 'text' and word!= 'footer'
            and word!= 'header' and word!= 'icon']
    return words
'''
    
'''
def searchDatabaseForConstellations(constellation):
    cmd = getSQLCommandSelectWhere("constellations", "name", constellation)
    constellationsWithName = []
    print(cmd)
    if stat.execute(cmd):
            columns = 3
            results = stat.getResultSet()
            print(type(results))
            while results.next():
                for c in range(1, columns + 1):
                    if(c == 0):
                        constellationsWithName.append(results.getString(1))
                print
                '''
